package com.augn.controller;

import com.augn.entity.Manufacturer;
import com.augn.entity.Result;
import com.augn.entity.Manufacturer;
import com.augn.service.IManufacturerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Iterator;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author augn
 * @since 2022-09-22
 */
@RestController
@RequestMapping("/manufacturer")
public class ManufacturerController {

    @Autowired
    private IManufacturerService service;

    @PostMapping("/insertOne")
    public Result<?> insertOneManufacturer(@RequestBody Manufacturer manufacturer){
        return service.insertOneManufacturer(manufacturer);
    }

    @DeleteMapping("/deleteOne/{id}")
    public Result<?> deleteOneManufacturer(@PathVariable Integer id){
        return service.deleteOneManufacturer(id);
    }

    @PutMapping("/updateOne")
    public Result<?> updateOneManufacturer(@RequestBody Manufacturer manufacturer){
        return service.updateOneManufacturer(manufacturer);
    }

    @PostMapping("/getPart")
    public Result<?> getPartManufacturer(@RequestBody Manufacturer manufacturer,
                                         @RequestParam(required = false) Integer pageNum,
                                         @RequestParam(required = false) Integer pageSize){
        return service.getPartManufacturer(manufacturer,pageNum,pageSize);
    }

}
